from langchain_openai import ChatOpenAI

api_key = "empty"
base_url = "http://localhost:8000/v1"
model_name = "qwen3-1.7b"

llm = ChatOpenAI(api_key=api_key, base_url=base_url, model_name=model_name)

def translate_text(text):
    prompt = f"请将以下文本从中文翻译成英文:\n{text}"
    response = llm.invoke(prompt)
    return response.content

if __name__ == "__main__":
    user_input = input("请输入要翻译的中文文本: ")
    translated_text = translate_text(user_input)
    print('*' * 50)
    print(f"翻译结果: {translated_text}")



